package com.sunnada.edu.business.contract.service;

import java.util.HashMap;

import com.sunnada.edu.system.pub.common.AppContext;
import com.sunnada.edu.system.pub.common.MD5;
import com.sunnada.edu.system.pub.dao.PubDao;

public class ContractMethods {

	public static int updateWorkerContract(HashMap<String, String> params) {
		PubDao dao = AppContext.getInstance().getPubDao();
		String recId = params.get("recId");
		String bgtime = params.get("bgtime");
		String edtime = params.get("edtime");
		String validity = params.get("validity");
		String sql = "update t_worker set  HTBGTIME='" + bgtime + "',HTEDTIME='" + edtime + "',VALIDATY='" + validity + "',HTCREATETIME=now() where rec_id='" + recId + "'";
		int num = dao.update(sql);
		return num;

	}
	
	
	public static int deleteWorkerContract(HashMap<String, String> params) {
		PubDao dao = AppContext.getInstance().getPubDao();
		String recIds = params.get("recIds");
		String sql = "update t_worker set  HTBGTIME=null,HTEDTIME=null,VALIDATY=null,HTCREATETIME=null where rec_id in("+recIds+")";
		int num = dao.update(sql);
		return num;

	}

	public static int getContractByName(HashMap<String, String> params) {
		PubDao dao = AppContext.getInstance().getPubDao();
		String name = params.get("name");
		String sql = "SELECT NAME FROM T_CONTRACT T WHERE  NAME='"+name+"' AND REC_STATUS!='2' ";
		return dao.selectListCot(sql);
	}

}
